package com.tyhy.program.cbc.mobileapi.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.tyhy.program.cbc.mobileapi.redis.websocket.PublishService;

import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping("/cbc/test/wsmsg")
@Slf4j
public class TestSendMsg {
	
	@Autowired
    private PublishService publishService;
	
	@RequestMapping("/sendmsg")
    public void sendmsg(String token,String msg){
		
		log.info("向客户端发送消息token={},msg={}",token,msg);
		
		String channel = token;
		String message = msg;
		
		publishService.publishMessge(channel, message);
		
		
    }

}
